package com.jltx.xq.appslimpro;

import android.content.res.AssetManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.ViewGroup;
import android.widget.ImageView;

import java.io.IOException;
import java.io.InputStream;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ViewGroup left = ViewHelperUtils.findViewById(this,R.id.left);
        ImageView imgL = ViewHelperUtils.findViewById(left,R.id.img);
        imgL.setImageResource(R.drawable.baidu);
        ViewGroup right = ViewHelperUtils.findViewById(this,R.id.right);
        ImageView imgR = ViewHelperUtils.findViewById(right,R.id.img);
        imgR.setImageResource(R.drawable.aitaobao);

        AssetManager assetManager = getAssets();
        try {
            InputStream in = assetManager.open("pic_name1.webp");
            Bitmap  bitmap = BitmapFactory.decodeStream(in);
            imgR.setImageBitmap(bitmap);
        }catch (IOException e){

        }

    }
}
